
public class Opp1c_TowersOfHanoi_stigma {
	
	private int totalDisks;
	private long totalMoves = 0;

	public Opp1c_TowersOfHanoi_stigma(int disks) {
		totalDisks = disks;
	}

	public void solve() {
		moveTower(totalDisks, 1, 3, 2);
	}

	private void moveTower(int numDisks, int start, int end, int temp) {
		if (numDisks == 1)
			moveOneDisk(start, end);

		else {
			moveTower(numDisks - 1, start, temp, end);
			moveOneDisk(start, end);
			moveTower(numDisks - 1, temp, end, start);
		}
	}

	private void moveOneDisk(int start, int end) {
		//System.out.println("Move one disk from " + start + " to " + end);
		this.totalMoves++;
		//System.out.println(totalMoves);
	}
	
	public long getTotalMoves() {
		return this.totalMoves;
	}

}
